<?php get_header(); ?>

<div class="content-area">

	<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

		<div class="page-content">
			<?php the_content();?>
			<?php if (have_rows('home_sections')): ?>
				<?php while (have_rows('home_sections')): the_row(); ?>

					<section class="bg-<?php echo get_sub_field('section_bgcolor');?>" id="<?php echo get_sub_field('section_anchor');?>">
						<div class="container">
						
							<?php if (get_sub_field('additional_title')) {
								echo '<h5 class="sub-title">' . get_sub_field('additional_title').'</h5>';
							}?>

							<?php if (get_sub_field('section_title')) {
								$section_title = '<h2 class="section-title">' . get_sub_field('section_title');
								if (get_sub_field('en_section_title')) {
									$section_title .= '<span>/' . get_sub_field('en_section_title') . '</span>';
								}
								$section_title .= '</h2>';
							}?>

							<?php 
								if(get_sub_field('title_position') == 'center'){
									echo '<div class="text-center">'.$section_title.'</div>';
								}
							?>
							<?php if (get_sub_field('section_content')) {?>
								<div class="row zero-row">
									<div class="col-xs-12 <?php if(get_sub_field('section_content2')) echo 'col-sm-6';?>">
										<div class="first-area">
											<?php
												if (get_sub_field('title_position') == 'left') {
													echo $section_title;
												}
											?>
											<?php echo get_sub_field('section_content');?>
										</div>	
									</div>

									<?php if (get_sub_field('section_content2')) {?>
										<div class="col-xs-12 col-sm-6">
											<div class="right-area">
												<?php
													if (get_sub_field('title_position') == 'right') {
														echo $section_title;
													}
												?>
												<?php echo get_sub_field('section_content2');?>
											</div>
										</div>
									<?php }?>
								</div>
							<?php }?>

						</div>
					</section>

				<?php endwhile;?>
			<?php endif;?>

		</div>

	<?php
		endwhile;
	endif; ?>
</div>

<?php get_footer();?>